/**
 * 
 */
package controller;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import view.View;

/**
 * @author ezuera
 *
 */
public class NewProjectWindowListener implements ActionListener {
	
	private Controller controller;
	
	public NewProjectWindowListener(Controller controller) {
		
		this.controller = controller;
		
	}
	/* (non-Javadoc)
	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
	 */
	@Override
	public void actionPerformed(ActionEvent e) {
		switch(e.getActionCommand()) {
		case View.NEWPROJECT:
			try {
				this.controller.saveNew(View.NEWPROJECT);
				this.controller.closeNewProject();
			} catch (NoSuchFieldException er) {
				this.controller.showProjektFehler(er.getMessage());
			}
			break;
		case View.CLOSECHOOSER:
			this.controller.closeNewProject();
		}
		
	}

}
